package cz.muni.fi.pa165.sme.web.common;

import java.util.Date;

import org.joda.time.DateTime;

/**
 * @author jirankova
 */
public final class DateUtils {
	private DateUtils(){}

	public static Date convertToDate(final DateTime source) {
		if(source == null) {
			return null;
		}

		return new Date(source.toGregorianCalendar().getTimeInMillis());
	}

	public static DateTime convertToDateTime(final Date source) {
		if(source == null) {
			return null;
		}

		return new DateTime(source.getTime());
	}
}
